<?php
/**
 * （国内）到货，库存入库（国内库存入库记录）
 * (model)
 */

namespace App\Models\Inventory;

use App\Models\Basics\Supplier;
use Illuminate\Database\Eloquent\Model;
class Storage extends Model
{
    protected $table = 'in_storage';

    protected $guarded = [];

    const TYPE_RECEIVE = 1; //收货入库
    const TYPE_MIX = 2; //组合入库
    const TYPE_SPLIT = 3; //拆分入库
    const TYPE_OTHER = 4; //其它入库
    public static $_type = [
        self::TYPE_RECEIVE => '收货入库',
        self::TYPE_MIX => '组合入库',
        self::TYPE_SPLIT => '拆分入库',
        self::TYPE_OTHER => '其它入库'
    ];

    public function detail(){
        return $this->hasMany(StorageDetail::class,'storage_no','storage_no');
    }

    public function supplier(){
        return $this->belongsTo(Supplier::class,'supplier_id');
    }
}
